﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Utilities.QuickSql;
using MySql.Data;

namespace Deviseur_Cs2i_Car
{
    class SSOPTION
    {
        string NomSSOption;
        int NumSSOption;
        double PrixSSOption;

        OPTION optn = new OPTION();

        public SSOPTION() { }

        public SSOPTION(string NomSSOption, double PrixSSOption,int option)
        {
            this.NomSSOption = NomSSOption;
            this.PrixSSOption = PrixSSOption;
            this.optn.set_NumOption(option);
        }
        public SSOPTION(int NumSSOption, string NomSSOption, double PrixSSOption, int option)
        {
            this.NumSSOption = NumSSOption;
            this.NomSSOption = NomSSOption;
            this.PrixSSOption = PrixSSOption;
            this.optn.set_NumOption(option);
        }

        public int get_NumSSOption()
        {
            return this.NumSSOption;
        }
        public string get_NomSSOption()
        {
            return this.NomSSOption;
        }
        public double get_PrixSSOption()
        {
            return this.PrixSSOption;
        }

        public void set_NumSSOption(int NumSSOption)
        {
            this.NumSSOption = NumSSOption;
        }
        public void set_NomSSOption(string NomSSOption)
        {
            this.NomSSOption = NomSSOption;
        }
        public void set_PrixSSOption(double PrixSSOption)
        {
            this.PrixSSOption = PrixSSOption;
        }
        public void set_Option(OPTION o)
        {
            this.optn = o;
        }
        public void affiche_SSOption()
        {
            Console.WriteLine("Num sous option : ", this.NumSSOption);
            Console.WriteLine("Nom sous option : ", this.NomSSOption);
            Console.WriteLine("prix sous option: ", this.PrixSSOption);

        }
        public void new_SSOption()
        {
            Program.Db.Execute("INSERT INTO SSOPTION(NomSSOption,PrixSSOption,NumOption) VALUES ( '" + this.NomSSOption + "', '" + this.PrixSSOption + "', '" + this.optn.get_NumOption() + "')");
        }
        public void modify_SSOption()
        {
            Program.Db.Execute("UPDATE SSOPTION SET NomSSOption = '" + this.NomSSOption + "', PrixSSOption = '" + this.PrixSSOption + "', NumOption = " + this.optn.get_NumOption() + " WHERE NumSSOption = " + this.NumSSOption + "");
        }
        public void delete_SSOption(int NumSSOption)
        {
            Program.Db.Execute("DELETE FROM SSOPTION  WHERE NumSSOption = " + NumSSOption + "");
        }


    }
}

